﻿@{      
    Layout = "../Shared/_Default.cshtml";
    ViewBag.PageTitle = T(Res.Name("Title"),
        Svc.Price((decimal)Model.Amount),
        Model.InvoiceID);
}

@section Sidebar
{
    @{
        Html.RenderAction(Loc.Act("_Overview").Ctrl("Invoice").Set(new
        {
            id = Model.InvoiceID
        }).Localized());
    }
}
<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('.payment-method > section').hide();
        jQuery('@ID("#form") input[name=processorID]').change(function () {
            jQuery('.payment-method > section').hide();
            jQuery('#pm_' + jQuery(this).val()).show();
        });
    });
</script>
<form class="page-form" id="@ID("form")" action="@Url.Action(Loc.Act("Place").Localized())" method="post">
    <input type="hidden" name="invoiceID" value="@Model.InvoiceID" />
    <input type="hidden" name="amount" value="@Svc.Price((decimal)Model.Amount)" />
    <div class="box">
        <section>
            <div class="hint">
                <p>@T(Res.Name("Hint"))</p>
            </div>
            <ul class="unit-list payment-method">
            @foreach(var i in Model.PaymentMethods)
            {
                <li class="unit payment-method">
                    <header>
                        @if(JDM.Boolean(i.Availability))
                        {
                            <input type="radio" name="processorID" value="@JDM.Guid(i.Info.ID)" />
                        }
                        @String.Format("{0} [{1}]", JDM.String(i.Info.Name), JDM.Boolean(i.Availability) ? Svc.Price((decimal)JDM.Decimal(i.HandlingFee)) : "N/A")
                    </header>
                    <section id="pm_@JDM.Guid(i.Info.ID)">
                    @{
                        Html.RenderPartial((string)String.Format("_pm_{0}", JDM.Guid(i.Info.ID)), new ViewDataDictionary
                        {
                            {"Mode", "Place"}
                        });
                    }
                    </section>
                </li>
            }
            </ul>
        </section>
    </div>
    <ul class="bar toolbar">
        <li><button class="button" type="submit">@T(Res.In("Common").Of("Act").Name("Submit"))</button></li>
    </ul>
</form>